/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package org.test.mainframe;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 *
 * @author lego
 */
@Entity
@Table(name = "BAND", catalog = "", schema = "ADMIN1")
@NamedQueries({
    @NamedQuery(name = "Band.findAll", query = "SELECT b FROM Band b"),
    @NamedQuery(name = "Band.findByBandname", query = "SELECT b FROM Band b WHERE b.bandname = :bandname"),
    @NamedQuery(name = "Band.findByBandid", query = "SELECT b FROM Band b WHERE b.bandid = :bandid")})
public class Band implements Serializable {
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final long serialVersionUID = 1L;
    @Basic(optional = false)
    @Column(name = "BANDNAME")
    private String bandname;
    @Id
    @Basic(optional = false)
    @Column(name = "BANDID")
    private Integer bandid;

    public Band() {
    }

    public Band(Integer bandid) {
        this.bandid = bandid;
    }

    public Band(Integer bandid, String bandname) {
        this.bandid = bandid;
        this.bandname = bandname;
    }

    public String getBandname() {
        return bandname;
    }

    public void setBandname(String bandname) {
        String oldBandname = this.bandname;
        this.bandname = bandname;
        changeSupport.firePropertyChange("bandname", oldBandname, bandname);
    }

    public Integer getBandid() {
        return bandid;
    }

    public void setBandid(Integer bandid) {
        Integer oldBandid = this.bandid;
        this.bandid = bandid;
        changeSupport.firePropertyChange("bandid", oldBandid, bandid);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (bandid != null ? bandid.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Band)) {
            return false;
        }
        Band other = (Band) object;
        if ((this.bandid == null && other.bandid != null) || (this.bandid != null && !this.bandid.equals(other.bandid))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.test.mainframe.Band[ bandid=" + bandid + " ]";
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }
    
}
